Skip to content

Conversation

@v-amolpatil
Copy link
Contributor

@v-amolpatil v-amolpatil commented Oct 16, 2025

Required items, please complete

Change(s):

  • Updated workflow for asim as they are not running for fork pr.

Reason for Change(s):

  • Specified above

Version Updated:

  • NA

Testing Completed:

  • Yes

Checked that the validations are passing and have addressed any issues that are present:

  • Yes

@v-amolpatil v-amolpatil self-assigned this Oct 16, 2025
Introduces a security approval job to require a 'safe to test' label for forked pull requests before running ASIM Schema and Data testers. The workflow checks for race conditions (commits after label approval) and provides automated guidance comments for maintainers. Also updates trigger to use pull_request_target, adds concurrency control.
Comment on lines 29 to +41
jobs:
# Security gate: Fork PRs require manual approval via "safe to test" label
# Internal PRs (same repo) can proceed without labels
security-gate:
name: Security approval gate for fork PRs
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:

Check failure

Code scanning / CodeQL

Checkout of untrusted code in trusted context High

Potential execution of untrusted code on a privileged workflow (
pull_request_target
)
Update the workflow to use the most recent 'safe to test' label event by switching from 'head -1' to 'tail -1' when parsing the timeline. Also remove an unnecessary exit statement in the manual approval branch.
Comment on lines 170 to 196
});
// Check if we already have a guidance comment to avoid spam
const existingComment = comments.find(comment =>
comment.body.includes('🔒 **Security Approval Required**') &&
comment.user.type === 'Bot'
);
let commentBody = '';
// Check what type of approval is needed based on the step outputs
if ('${{ steps.check-approval.outputs.needs_reapproval }}' === 'true') {
commentBody = `🔒 **Security Re-approval Required**
⚠️ **Race condition detected**: New commits were pushed after the \`safe to test\` label was added.
**For security, a maintainer must:**
1. 📝 Review the latest commits carefully for any security concerns
2. 🏷️ Remove the \`safe to test\` label
3. 🏷️ Re-add the \`safe to test\` label if the new commits are safe
This ensures that all commits have been properly reviewed before testing with repository secrets.
---
*This is an automated security check to prevent malicious code execution. Learn more about [GitHub Security Lab recommendations](https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/).*`;
} else {
commentBody = `🔒 **Security Approval Required**

Check failure

Code scanning / CodeQL

Checkout of untrusted code in a privileged context Critical

Potential execution of untrusted code on a privileged workflow (
pull_request_target
)
Comment on lines 201 to 208
1. 📝 Review the code changes carefully
2. 🏷️ Add the \`safe to test\` label if the changes are safe to execute
This protects against malicious code execution in fork contributions.
---
*This is an automated security check to prevent malicious code execution. Learn more about [GitHub Security Lab recommendations](https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/).*`;
}

Check failure

Code scanning / CodeQL

Checkout of untrusted code in trusted context High

Potential execution of untrusted code on a privileged workflow (
pull_request_target
)
Replaces use of repo.pushed_at with the actual PR head commit timestamp by fetching commit details via the GitHub API. Adds additional debug logging to the comment step for better traceability and updates log messages for comment creation and updates.
Update workflow to always create a new security guidance comment instead of updating or deleting previous ones. This preserves the audit trail by keeping all past comments for reference.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants